# Copyright (c) 2025 Li Auto Inc. and its affiliates
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

#
# static_library_internal.mk
#

include $(BUILD_SYSTEM)/base_rules.mk

$(LOCAL_TARGET): PRIVATE_ALL_OBJS:=$(LOCAL_C_OBJS) $(LOCAL_CPP_OBJS)
$(LOCAL_TARGET): PRIVATE_LIBRARY:=
$(LOCAL_TARGET): PRIVATE_IMPORT_INCLUDES:= $(import_includes)
$(LOCAL_TARGET): PRIVATE_CFLAGS:= $(GLOBAL_CFLAGS) $(LOCAL_CFLAGS)
$(LOCAL_TARGET): PRIVATE_LFLAGS:=
$(LOCAL_TARGET): PRIVATE_LDS:=
$(LOCAL_TARGET): PRIVATE_INCLUDES:=$(addprefix $(LOCAL_PATH)/, $(LOCAL_INC_DIR))

$(LOCAL_TARGET): $(foreach lib,$(LOCAL_STATIC_LIBRARIES), $(ALL_MODULES.$(lib).BUILT))
$(LOCAL_TARGET): $(LOCAL_C_OBJS) $(LOCAL_CPP_OBJS)
$(LOCAL_TARGET): $(LOCAL_MODULE_MAKEFILE)

$(LOCAL_TARGET):
	$(transform-o-to-static-lib)

$(LOCAL_C_OBJS): $(LOCAL_OUT)/%.o: $(LOCAL_PATH)/%.c
	$(transform-c-to-o)
	$(transform-c-to-cmd)

$(LOCAL_CPP_OBJS): $(LOCAL_OUT)/%.o: $(LOCAL_PATH)/%.cpp
	$(transform-cpp-to-o)
	$(transform-cpp-to-cmd)

# Provide some fake target for using easily
$(LOCAL_MODULE): $(LOCAL_TARGET)

.PHONY: $(LOCAL_MODULE)

# vim:ft=make
#
